# Generated from http://standards.ieee.org/regauth/oui/oui.txt
MAC_PREFIXES = {
    'Sony-Ericsson' : (
        '00:01:EC',
        '00:0A:D9',
        '00:0E:07',
        '00:0F:DE',
        '00:12:EE',
        '00:15:E0',
        '00:16:20',
        '00:16:B8',
        '00:18:13',
        '00:19:63',
        '00:1A:75',
        '00:1B:59',
        '00:1C:A4',
        '00:1D:28',
        '00:1E:45',
        '00:80:37',
        ),
    'Nokia' : (
        '00:02:EE',
        '00:0B:E1',
        '00:0E:ED',
        '00:0F:BB',
        '00:10:B3',
        '00:11:9F',
        '00:12:62',
        '00:13:70',
        '00:13:FD',
        '00:14:A7',
        '00:15:2A',
        '00:15:A0',
        '00:15:DE',
        '00:16:4E',
        '00:16:BC',
        '00:17:4B',
        '00:17:B0',
        '00:18:0F',
        '00:18:42',
        '00:18:8D',
        '00:18:C5',
        '00:19:2D',
        '00:19:4F',
        '00:19:79',
        '00:19:B7',
        '00:1A:16',
        '00:1A:89',
        '00:1A:DC',
        '00:1B:33',
        '00:1B:AF',
        '00:1B:EE',
        '00:1C:35',
        '00:1C:9A',
        '00:1C:D4',
        '00:1C:D6',
        '00:1D:3B',
        '00:1D:6E',
        '00:1D:98',
        '00:1D:E9',
        '00:1D:FD',
        '00:1E:3A',
        '00:1E:3B',
        '00:1E:A3',
        '00:1E:A4',
        '00:40:43',
        '00:A0:8E',
        '00:E0:03',
        ),
    'Siemens' : (
        '00:01:E3',
        '00:05:19',
        '00:0B:23',
        '00:0B:A3',
        '00:0D:41',
        '00:0E:8C',
        '00:0F:BB',
        '00:11:06',
        '00:11:33',
        '00:13:A3',
        '00:18:D1',
        '00:19:28',
        '00:19:99',
        '00:1A:D0',
        '00:1A:E8',
        '00:1B:1B',
        '00:1C:06',
        '00:30:05',
        '00:50:07',
        '00:90:40',
        '00:C0:E4',
        '08:00:06',
        ),
    'Samsung' : (
        '00:00:F0',
        '00:02:78',
        '00:09:18',
        '00:0D:AE',
        '00:0D:E5',
        '00:0F:73',
        '00:12:47',
        '00:12:FB',
        '00:13:77',
        '00:15:99',
        '00:15:B9',
        '00:16:32',
        '00:16:6B',
        '00:16:6C',
        '00:16:DB',
        '00:17:C9',
        '00:17:D5',
        '00:18:AF',
        '00:1A:8A',
        '00:1B:98',
        '00:1C:43',
        '00:1D:25',
        '00:1D:F6',
        '00:1E:7D',
        '00:E0:64',
        ),
    'LG' : (
        '00:05:C9',
        '00:0B:29',
        '00:12:56',
        '00:14:80',
        '00:19:A1',
        '00:1C:62',
        '00:1E:75',
        '00:1E:B2',
        '00:50:CE',
        '00:E0:91',
        ),
    'BenQ' : (
        '00:03:9D',
        '00:17:CA',
        ),
    'Motorola' : (
        '00:01:AF',
        '00:04:56',
        '00:04:BD',
        '00:08:0E',
        '00:0A:28',
        '00:0B:06',
        '00:0C:E5',
        '00:0E:5C',
        '00:0E:C7',
        '00:0F:9F',
        '00:11:1A',
        '00:11:80',
        '00:11:AE',
        '00:12:25',
        '00:12:8A',
        '00:12:C9',
        '00:13:71',
        '00:14:04',
        '00:14:9A',
        '00:14:E8',
        '00:15:2F',
        '00:15:9A',
        '00:15:A8',
        '00:16:26',
        '00:16:75',
        '00:16:B5',
        '00:17:00',
        '00:17:84',
        '00:17:E2',
        '00:17:EE',
        '00:18:A4',
        '00:18:C0',
        '00:19:2C',
        '00:19:5E',
        '00:19:A6',
        '00:19:C0',
        '00:1A:1B',
        '00:1A:66',
        '00:1A:77',
        '00:1A:AD',
        '00:1A:DB',
        '00:1A:DE',
        '00:1B:52',
        '00:1B:DD',
        '00:1C:11',
        '00:1C:12',
        '00:1C:C1',
        '00:1C:FB',
        '00:1D:6B',
        '00:1D:BE',
        '00:1E:46',
        '00:1E:5A',
        '00:1E:8D',
        '00:20:40',
        '00:20:75',
        '00:A0:BF',
        '00:C0:F9',
        '00:E0:0C',
        ),
    'Alcatel' : (
        '00:07:72',
        '00:08:9A',
        '00:0E:86',
        '00:0F:62',
        '00:11:3F',
        '00:11:8B',
        '00:15:3F',
        '00:16:4D',
        '00:17:CC',
        '00:19:8F',
        '00:1A:F0',
        '00:1C:8E',
        '00:1D:4C',
        '00:20:32',
        '00:20:60',
        '00:20:DA',
        '00:80:21',
        '00:80:39',
        '00:80:9F',
        '00:A0:81',
        '00:C0:BE',
        '00:D0:95',
        '00:D0:F6',
        '00:E0:B1',
        '00:E0:DA',
        ),
    'Sharp' :   (
        '00:17:5C',
        '00:1C:EE',
        '08:00:1F'
        )
}

GAMMU_CONN_BLUETOOTH_ALL = (
    'bluephonet',
    'bluefbus',
    'bluerfgnapbus',
    'blueat',
    'blueobex',
    'bluerfobex',
    'bluerfphonet',
    'bluerffbus',
    'bluerfat',
)
GAMMU_CONN_BLUETOOTH_NOKIA = (
    'bluephonet',
    'bluefbus',
    'bluerfgnapbus',
    'bluerfphonet',
    'bluerffbus',
    'blueat',
    'bluerfat',
    'blueobex',
    'bluerfobex',
)
GAMMU_CONN_BLUETOOTH_STANDARD = (
    'blueat',
    'blueobex',
    'bluerfgnapbus',
)
GAMMU_CONN_BLUETOOTH = {
    'Sony-Ericsson' :   GAMMU_CONN_BLUETOOTH_STANDARD,
    'Siemens'       :   GAMMU_CONN_BLUETOOTH_STANDARD,
    'BenQ'          :   GAMMU_CONN_BLUETOOTH_STANDARD,
    'Samsung'       :   GAMMU_CONN_BLUETOOTH_STANDARD,
    'LG'            :   GAMMU_CONN_BLUETOOTH_STANDARD,
    'Motorola'      :   GAMMU_CONN_BLUETOOTH_STANDARD,
    'Nokia'         :   GAMMU_CONN_BLUETOOTH_NOKIA,
    'Alcatel'       :   GAMMU_CONN_BLUETOOTH_STANDARD,
    'Sharp'         :   GAMMU_CONN_BLUETOOTH_STANDARD,
}

GAMMU_CONN_CABLE = (
    'at19200',
    'at115200',
    'fbusdlr3',
    'fbus',
    'mbus',
    'fbuspl2303',
    'phonetblue',
    'fbusblue',
)
GAMMU_CONN_IRDA = (
    'irdaphonet',
    'at19200',
)
GAMMU_CONN_BLUERF = (
    'at19200',
)
GAMMU_CONN_DEVICES = (
    (('/dev/ttyS%d' % i for i in range(3)),      GAMMU_CONN_CABLE    ),
    (('/dev/ttyUSB%d' % i for i in range(3)),    GAMMU_CONN_CABLE    ),
    (('/dev/ttyACM%d' % i for i in range(3)),    GAMMU_CONN_CABLE    ),
    (('/dev/rfrcomm%d' % i for i in range(1)),   GAMMU_CONN_BLUERF   ),
    (('/dev/ircomm%d' % i for i in range(1)),    GAMMU_CONN_IRDA     ),
    (('/dev/usb/tts/%d' % i for i in range(3)),  GAMMU_CONN_CABLE    ))

def get_vendor_from_bluetooth_address(address):
    for vendor in MAC_PREFIXES.keys():
        if address[:8].upper() in MAC_PREFIXES[vendor]:
            return vendor
    return None
    
def get_connections_from_bluetooth_address(address):
    vendor = get_vendor_from_bluetooth_address(address)
    if vendor:
        return GAMMU_CONN_BLUETOOTH[vendor]
    return GAMMU_CONN_BLUETOOTH_ALL

